﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Model_SSResourceManager;

namespace Presenter_SSResourceManager
{
    public class PresenterEditUser
    {
        private readonly IViewEditUser _viewEditUser;
        private readonly ModelsManager _mModel;

        public PresenterEditUser(IViewEditUser view)
        {
            this._viewEditUser = view;
            _mModel = ModelInstanse.Get();

        }

        public void FillFieldToEdit()
        {
            var userId = _viewEditUser.GetUserId();
            var user = _mModel.userModel.Get(userId);
            _viewEditUser.FillPageFields(user);
        }

        public void Update()
        {
            var userId = _viewEditUser.GetUserId();
            var user = _mModel.userModel.Get(userId);
            var updateUser = _viewEditUser.GatherPageFieldsInformation(user);
            _mModel.userModel.Update(user);
        }

    }
}
